Switch NuGet publishing to trusted publishing - #6573
Conversation
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Comment |
Greptile SummaryThe PR replaces the long-lived NuGet API-key secret with an OIDC trusted-publishing login and forwards the resulting short-lived key into the existing pipeline.
Confidence Score: 4/5The PR appears safe to merge functionally, with non-blocking security hardening needed around permission scope and immutable action pinning. The login and publishing conditions align and the pipeline safely handles an absent API key, but unrelated matrix executions inherit publishing privileges and the new login action can change without a repository-reviewed commit update. Files Needing Attention: .github/workflows/dotnet.yml
|
| Filename | Overview |
|---|---|
| .github/workflows/dotnet.yml | Correctly wires trusted NuGet publishing into the existing pipeline, but broadens permissions across the full matrix and references the privileged login action through a mutable tag. |
Sequence Diagram
sequenceDiagram
actor Maintainer
participant GHA as GitHub Actions
participant NuGetLogin as NuGet/login
participant NuGet as nuget.org
participant Pipeline as TUnit.Pipeline
Maintainer->>GHA: "Dispatch main workflow with publish-packages=true"
GHA->>NuGetLogin: Run Ubuntu login with OIDC permission
NuGetLogin->>GHA: Request GitHub OIDC token
NuGetLogin->>NuGet: Exchange identity for temporary API key
NuGet-->>NuGetLogin: NUGET_API_KEY
NuGetLogin-->>GHA: Expose action output
GHA->>Pipeline: Pass NuGet__ApiKey and ShouldPublish
Pipeline->>NuGet: Publish generated packages
Reviews (1): Last reviewed commit: "Switch NuGet publishing to trusted publi..." | Re-trigger Greptile
| permissions: | ||
| contents: write | ||
| id-token: write |
There was a problem hiding this comment.
Publishing permissions span full matrix
The job-level contents: write and id-token: write permissions apply to pull-request, non-publishing, Windows, and macOS executions even though OIDC login and release operations are restricted to the main/Ubuntu publishing path. Scoping these capabilities to a dedicated publishing job would reduce the impact of compromised actions or unintended pipeline behavior.
How this was verified: The permissions are assigned to the matrix job, while the OIDC-dependent login is gated to main, publishing enabled, and Ubuntu.
Knowledge Base Used: Build and CI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| - name: NuGet login | ||
| if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.publish-packages == 'true' && matrix.os == 'ubuntu-latest' }} | ||
| uses: NuGet/login@v1 |
There was a problem hiding this comment.
Publishing action uses mutable tag
NuGet/login@v1 can resolve to different executable code without a repository-reviewed change, while this step receives the NuGet identity and can request an OIDC token. Pinning the action to a reviewed commit would make changes to this security-sensitive publishing dependency explicit.
How this was verified: The publishing step references the mutable v1 tag and runs with NUGET_USER plus job-level OIDC permission.
Knowledge Base Used: Build and CI
Code reviewReviewed the switch to NuGet trusted publishing (OIDC via Verified as sound:
Worth a follow-up (non-blocking):
Both were also flagged by greptile-apps' automated review; I independently verified them against the pipeline source rather than taking that at face value. |
Summary
Validation
Follow-up
A matching trusted publishing policy must be configured on nuget.org for this repository and workflow file before the next publish run.